<me:UIJJRULES x:Class="WPFExcelReport.TJJRULES"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR" 
                     xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    FontSize="16"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIJJRULES.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIJJRULES.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.ColumnSpan="2" >
            <WrapPanel Margin="0,20,0,0">
                <DR:TDRAUFTR Name="cDR" Visibility="Collapsed"
                    DocType="LOADEXCEL"  
                             DESTFOLDER="{Binding ART,ElementName=TV}"
                             PREFIX="{Binding VAR,ElementName=TV}"  />
                <Button Margin="15,0,0,0" Content="{Binding Source={Localization:Translate Word=外部导入}}" Click="LoadExcelCommand"></Button>
                <TextBox Text="{Binding ART,ElementName=TV}" Width="200"/>
                <TextBox Text="{Binding VAR,ElementName=TV}" Width="60"/>
            </WrapPanel>
            <WrapPanel Margin="0,20,0,0" >
                <Button  Click="QueryCommand" Width="24" Height="20" Margin="10,0,0,0" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
                <Button  Click="EditCommand" Width="24" Height="20" Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                    </Button.Background>
                </Button>
                <Button   Click="SaveCommand" Width="24" Height="20" Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                    </Button.Background>
                </Button>
                <Button Margin="15,0,0,0" Content="{Binding Source={Localization:Translate Word=新建}}"  Click="NewCommand" Visibility="Collapsed"></Button>
                <Button Margin="15,0,0,0" Content="{Binding Source={Localization:Translate Word=复制}}" Click="CopyCommand" Visibility="Collapsed"></Button>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=时间:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding MINUTES, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"/>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=时间系数:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding RATIOM, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"/>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=调优系数:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding RATIOP, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"
                                   />
                </Grid>
                 
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=备注:}}"/>
                    <ex:TXT72 Grid.Column="1"  Text="{Binding REMARK, Source={StaticResource vwMaster},Converter={StaticResource gb2312} }" 
                                   MaxLength="80"
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="200"
                                   />
                </Grid>
             
            </WrapPanel>
            <WrapPanel>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=温度天数:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding WDDAYS, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"
                                   />
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=低惩罚:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding LOWPOINTS, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"
                                   />
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=高惩罚:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding HIGHPOINTS, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"
                                   />
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=惩罚上限:}}"/>
                    <ex:NumericBox Grid.Column="1"  Text="{Binding MAXLIMIT, Source={StaticResource vwMaster} }" 
                                   IsReadOnly="{Binding IsEdit,Converter={StaticResource not}}"
                                   Width="100"
                                   />
                </Grid>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1" Margin="0,20,0,0"
                   CanUserReorderColumns="True"  FontSize="12" HorizontalScrollBarVisibility="Auto" 
                   VerticalScrollBarVisibility="Auto"  CanUserResizeRows="True" CanUserSortColumns="True"  
                   AutoGenerateColumns="False"    EnableRowVirtualization="True"   
                   RowDetailsVisibilityMode="VisibleWhenSelected"   
                   ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}">
            <DataGrid.Columns> 
                <DataGridTextColumn Binding="{Binding Path=RTYPE}" Header="{Binding Source={Localization:TranslateExtension Word=规则分类}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MACHINEID}" Header="{Binding Source={Localization:TranslateExtension Word=设备组}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=PROPERTY}" Header="{Binding Source={Localization:TranslateExtension Word=属性}}"  Width="Auto" /> 
                <DataGridTextColumn Binding="{Binding Path=RGROUP}" Header="{Binding Source={Localization:TranslateExtension Word=组}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=RULEID}" Header="{Binding Source={Localization:TranslateExtension Word=ID}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JOBVDES, Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:TranslateExtension Word=任务属性类型}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=JOBV}" Header="{Binding Source={Localization:TranslateExtension Word=任务值}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=LOGIC}" Header="{Binding Source={Localization:TranslateExtension Word=运算}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=RVALUE}" Header="{Binding Source={Localization:TranslateExtension Word=规则值}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=DIFF}" Header="{Binding Source={Localization:TranslateExtension Word=阈值}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=RULEDES, Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:TranslateExtension Word=规则描述}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MINUTES}" Header="{Binding Source={Localization:TranslateExtension Word=分钟}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=RATIOM}" Header="{Binding Source={Localization:TranslateExtension Word=系数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=POINTS}" Header="{Binding Source={Localization:TranslateExtension Word=点数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=RATIOP}" Header="{Binding Source={Localization:TranslateExtension Word=系数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WD}" Header="{Binding Source={Localization:TranslateExtension Word=温度通道}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=WDDAYS}" Header="{Binding Source={Localization:TranslateExtension Word=持续天数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=LOWPOINTS}" Header="{Binding Source={Localization:TranslateExtension Word=低惩罚}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=HIGHPOINTS}" Header="{Binding Source={Localization:TranslateExtension Word=高惩罚}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=MAXLIMIT}" Header="{Binding Source={Localization:TranslateExtension Word=惩罚上限}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=REMARK, Converter={StaticResource ResourceKey=gb2312}}" Header="{Binding Source={Localization:TranslateExtension Word=备注}}"  Width="Auto" /> 
            </DataGrid.Columns>
        </DataGrid  >
    </Grid>
</me:UIJJRULES> 
 
